{$CLEO .cs}
03A4: name_thread 'WARSUPP'
0709: set_decision_maker 26@ on_event 15 taskID 1000 respect 0.0 hate 0.0 like 0.0 dislike 0.0 in_car 1 on_foot 1 // see *.ped files 
0709: set_decision_maker 26@ on_event 36 taskID 1000 respect 0.0 hate 0.0 like 0.0 dislike 0.0 in_car 1 on_foot 1 // see *.ped files 
0709: set_decision_maker 26@ on_event 15 taskID 1003 respect 0.0 hate 0.0 like 0.0 dislike 0.0 in_car 1 on_foot 1 // see *.ped files 
0709: set_decision_maker 26@ on_event 36 taskID 1003 respect 0.0 hate 0.0 like 0.0 dislike 0.0 in_car 1 on_foot 1 // see *.ped files 
:loadmodels
0001: wait 0 ms  // avoid pc hang
00D6: if 
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @loadmodels 
// peds
if
	823D:   not special_actor 1 loaded
then
	023C: load_special_actor 'SWEET' as 1 // models 290-299 
end
if
	823D:   not special_actor 2 loaded 
then
	023C: load_special_actor 'SMOKE' as 2 // models 290-299 
end
if
	823D:   not special_actor 3 loaded 
then
	023C: load_special_actor 'RYDER2' as 3 // models 290-299 
end
if
	823D:   not special_actor 4 loaded 
then
	023C: load_special_actor 'BBTHIN' as 4 // models 290-299 
end
if
	8248:   not model #FAM1 available 
then
	0247: load_model #FAM1 
end
if
	8248:   not model #FAM2 available 
then
	0247: load_model #FAM2 
end
if
	8248:   not model #FAM3 available 
then
	0247: load_model #FAM3 
end
// weapons
if
	8248:   not model #DESERT_EAGLE available 
then
	0247: load_model #DESERT_EAGLE 
end
if
	8248:   not model #SHOTGSPA available 
then
	0247: load_model #SHOTGSPA 
end
if
	8248:   not model #MP5LNG available 
then
	0247: load_model #MP5LNG 
end
if
	8248:   not model #M4 available 
then
	0247: load_model #M4 
end
if
	8248:   not model #GRENADE available 
then
	0247: load_model #GRENADE 
end
// cars
if
	8248:   not model #GREENWOO available 
then
	0247: load_model #GREENWOO 
end
if
	8248:   not model #SAVANNA available 
then
	0247: load_model #SAVANNA 
end
0001: wait 0 ms  // take time to load models
if and
0248:   model #FAM1 available
0248:   model #FAM2 available
0248:   model #FAM3 available
0248:   model #GREENWOO available
0248:   model #SAVANNA available
004D: jump_if_false @loadmodels
if and
023D:   special_actor 1 loaded 
023D:   special_actor 2 loaded 
023D:   special_actor 3 loaded 
023D:   special_actor 4 loaded 
004D: jump_if_false @loadmodels
00D6: if and
0248:   model #DESERT_EAGLE available
0248:   model #SHOTGSPA available
0248:   model #MP5LNG available
0248:   model #M4 available
0248:   model #GRENADE available
004D: jump_if_false @loadmodels

:initiatesupports
0001: wait 0 ms  // avoid pc hang

if
	087A:   gang_war_in_progress
004D: jump_if_false @initiatesupports

0001: wait 10000 ms // the spawn of enemy gang on the first wave takes approximately 10 seconds
FOR 31@ = 0 to 99 step 1
	0001: wait 0 ms
	09DD: unknown_player_group 31@
end
FOR 27@ = 0 to 20 step 5
	if
		27@<5
	then
		04C4: store_coords_to 29@ 30@ 31@ from_actor $PLAYER_ACTOR with_offset 100.0 0.0 5.0
	else
		if
			27@<10
		then
			04C4: store_coords_to 29@ 30@ 31@ from_actor $PLAYER_ACTOR with_offset 0.0 100.0 5.0
		else
			if
				27@<15
			then
				04C4: store_coords_to 29@ 30@ 31@ from_actor $PLAYER_ACTOR with_offset -100.0 0.0 5.0
			else
				if
					27@<20
				then
					04C4: store_coords_to 29@ 30@ 31@ from_actor $PLAYER_ACTOR with_offset 0.0 -100.0 5.0
				else
					if
						27@<25
					then
						04C4: store_coords_to 29@ 30@ 31@ from_actor $PLAYER_ACTOR with_offset 100.0 100.0 5.0
					end
				end
			end
		end
	end
	02C1: store_to 29@ 30@ 31@ car_path_coords_closest_to 29@ 30@ 31@
	0209: 28@ = random_int_in_ranges 0 2
	if
		28@ == 0
	then
		00A5: 0@(27@,25i) = create_car #GREENWOO at 29@ 30@ 31@
	else
		if
			28@ == 1
		then
			00A5: 0@(27@,25i) = create_car #SAVANNA at 29@ 30@ 31@
		else
		
		end
	end
	
	if
		27@<5
	then
		0129: 1@(27@,25i) = create_actor_pedtype 8 model #SPECIAL01 in_car 0@(27@,25i) driverseat // sweet
	else
		if
			27@<10
		then
			0129: 1@(27@,25i) = create_actor_pedtype 8 model #SPECIAL02 in_car 0@(27@,25i) driverseat // big smoke
		else
			if
				27@<15
			then
				0129: 1@(27@,25i) = create_actor_pedtype 8 model #SPECIAL03 in_car 0@(27@,25i) driverseat // ryder
			else
				if
					27@<20
				then
					0129: 1@(27@,25i) = create_actor_pedtype 8 model #SPECIAL04 in_car 0@(27@,25i) driverseat // big bear
				else
					0209: 28@ = random_int_in_ranges 0 3
					if
						28@==0
					then
						0129: 1@(27@,25i) = create_actor_pedtype 8 model #FAM1 in_car 0@(27@,25i) driverseat
					else
						if
							28@==1
						then
							0129: 1@(27@,25i) = create_actor_pedtype 8 model #FAM2 in_car 0@(27@,25i) driverseat
						else
							if
								28@==2
							then
								0129: 1@(27@,25i) = create_actor_pedtype 8 model #FAM3 in_car 0@(27@,25i) driverseat
							end
						end
					end
				end
			end
		end
	end
	
	035F: actor 1@(27@,25i) armour += 200 // give the leader armour
	
	0209: 28@ = random_int_in_ranges 0 3
	if
		28@==0
	then
		01C8: 2@(27@,25i) = create_actor_pedtype 8 model #FAM1 in_car 0@(27@,25i) passenger_seat 1
	else
		if
			28@==1
		then
			01C8: 2@(27@,25i) = create_actor_pedtype 8 model #FAM2 in_car 0@(27@,25i) passenger_seat 1
		else
			if
				28@==2
			then
				01C8: 2@(27@,25i) = create_actor_pedtype 8 model #FAM3 in_car 0@(27@,25i) passenger_seat 1
			end
		end
	end
	0209: 28@ = random_int_in_ranges 0 3
	if
		28@==0
	then
		01C8: 3@(27@,25i) = create_actor_pedtype 8 model #FAM1 in_car 0@(27@,25i) passenger_seat 2
	else
		if
			28@==1
		then
			01C8: 3@(27@,25i) = create_actor_pedtype 8 model #FAM2 in_car 0@(27@,25i) passenger_seat 2
		else
			if
				28@==2
			then
				01C8: 3@(27@,25i) = create_actor_pedtype 8 model #FAM3 in_car 0@(27@,25i) passenger_seat 2
			end
		end
	end
	0209: 28@ = random_int_in_ranges 0 3
	if
		28@==0
	then
		01C8: 4@(27@,25i) = create_actor_pedtype 8 model #FAM1 in_car 0@(27@,25i) passenger_seat 3
	else
		if
			28@==1
		then
			01C8: 4@(27@,25i) = create_actor_pedtype 8 model #FAM2 in_car 0@(27@,25i) passenger_seat 3
		else
			if
				28@==2
			then
				01C8: 4@(27@,25i) = create_actor_pedtype 8 model #FAM3 in_car 0@(27@,25i) passenger_seat 3
			end
		end
	end
	03CC: enable_car 0@(27@,25i) stuck_check_distance_to 2.0 time_to 1000
	00AE: set_car 0@(27@,25i) traffic_behaviour_to 2
	00A8: set_car 0@(27@,25i) to_psycho_driver
	0423: set_car 0@(27@,25i) improved_handling_to 2.0 // (float)
	00AD: set_car 0@(27@,25i) max_speed_to 50.0
	while true
		REPEAT
			00A0: store_actor $PLAYER_ACTOR position_to 29@ 30@ 31@
			0006: 28@ = -1
			0AE1: 28@ = random_actor_near_point 29@ 30@ 31@ in_radius 60.0 find_next 1 pass_deads 1
			if
				28@<>-1
			then
				if
					056D:   actor 28@ defined
				then
					089F: get_actor 28@ pedtype_to 29@
				end
				if and // any gangs except grove street
					29@>=7
					29@<>8
					29@<=16
				then
					Break
				end
			end
		UNTIL 28@ == -1
		if
			28@ <> -1
		then
			if
				056D:   actor 28@ defined
			then
				00A0: store_actor 28@ position_to 29@ 30@ 31@
				00A7: car 0@(27@,25i) drive_to 29@ 30@ 31@
				Break // Break the while loop block
			end
		end
		wait 0 ms // avoid pc hang
	end
	wait 1000 ms
end

:checklocation
wait 0 ms // avoid pc hang
if
	087A:   gang_war_in_progress
004D: jump_if_false @leakremover
FOR 27@ = 0 to 20 step 5
	if
		056E:   car 0@(27@,25i) defined
	then
		if and
			81C1:  not car 0@(27@,25i) stopped
			8495:  not car 0@(27@,25i) burning 
			82BF:  not car 0@(27@,25i) sunk 
			8119:  not car 0@(27@,25i) wrecked 
			00DF:  actor 1@(27@,25i) driving
			8118:  not actor 1@(27@,25i) dead
		then
			Continue
		end
		
		if
			056D:   actor 1@(27@,25i) defined
		then
			// 05CD: AS_actor 1@(27@,25i) exit_car 0@(27@,25i)
			if
				0449:   actor 1@(27@,25i) in_a_car
			then
				0633: AS_actor 1@(27@,25i) exit_car
				00AA: store_car 0@(27@,25i) position_to 29@ 30@ 31@
				05DC: AS_actor 1@(27@,25i) run_away_from_point 29@ 30@ 31@ stop_at_radius 25.0 timelimit 5000
			end
			if
				02D8:   actor 1@(27@,25i) current_weapon == 0 // unarmed
			then
				0209: 30@ = random_int_in_ranges 1 6
				if
					30@==1
				then
					01B2: give_actor 1@(27@,25i) weapon 16 ammo 9999 // give grenade
				else
					if
						30@==2
					then
						01B2: give_actor 1@(27@,25i) weapon 24 ammo 9999 // give desert eagle
					else
						if
							30@==3
						then
							01B2: give_actor 1@(27@,25i) weapon 27 ammo 9999 //  give spaz
						else
							if
								30@==4
							then
								01B2: give_actor 1@(27@,25i) weapon 29 ammo 9999 // give smg
							else
								if
									30@==5
								then
									01B2: give_actor 1@(27@,25i) weapon 31 ammo 9999 // m4
								end
							end
						end
					end
				end
				07DD: set_actor 1@(27@,25i) attack_rate 100 // previously known as temper_to
				077A: set_actor 1@(27@,25i) acquaintance 0 to_actors_pedtype 0 // respect cj
				077A: set_actor 1@(27@,25i) acquaintance 0 to_actors_pedtype 8 // respect Grove Street Families
				077A: set_actor 1@(27@,25i) acquaintance 4 to_actors_pedtype 6 // hate Cops
				077A: set_actor 1@(27@,25i) acquaintance 4 to_actors_pedtype 7 // hate Ballas
				077A: set_actor 1@(27@,25i) acquaintance 4 to_actors_pedtype 9 // hate Los Santos Vagos
				077A: set_actor 1@(27@,25i) acquaintance 4 to_actors_pedtype 10 // hate San Fierro Rifa
				077A: set_actor 1@(27@,25i) acquaintance 4 to_actors_pedtype 11 // hate Da Nang Boys
				077A: set_actor 1@(27@,25i) acquaintance 4 to_actors_pedtype 12 // hate Mafia
				077A: set_actor 1@(27@,25i) acquaintance 4 to_actors_pedtype 13 // hate Mountain Cloud Triad
				077A: set_actor 1@(27@,25i) acquaintance 4 to_actors_pedtype 14 // hate Varrio Los Aztecas
				077A: set_actor 1@(27@,25i) acquaintance 4 to_actors_pedtype 15 // hate gang 9
				077A: set_actor 1@(27@,25i) acquaintance 4 to_actors_pedtype 16 // hate gang 10
				060B: set_actor 1@(27@,25i) decision_maker_to 26@ // offensive state
				09B5: set_actor 1@(27@,25i) signal_after_kill 0 // disable the stupid homie handsign they are doing when they kill, making them uninteruptable and effective on gangfights
			end
		end
		
		if
			056D:   actor 2@(27@,25i) defined
		then
			// 05CD: AS_actor 2@(27@,25i) exit_car 0@(27@,25i)
			if
				0449:   actor 2@(27@,25i) in_a_car
			then
				0633: AS_actor 2@(27@,25i) exit_car
				00AA: store_car 0@(27@,25i) position_to 29@ 30@ 31@
				05DC: AS_actor 2@(27@,25i) run_away_from_point 29@ 30@ 31@ stop_at_radius 25.0 timelimit 5000
			end
			if
				02D8:   actor 2@(27@,25i) current_weapon == 0 // unarmed
			then
				0209: 30@ = random_int_in_ranges 1 6
				if
					30@==1
				then
					01B2: give_actor 2@(27@,25i) weapon 16 ammo 9999 // give grenade
				else
					if
						30@==2
					then
						01B2: give_actor 2@(27@,25i) weapon 24 ammo 9999 // give desert eagle
					else
						if
							30@==3
						then
							01B2: give_actor 2@(27@,25i) weapon 27 ammo 9999 //  give spaz
						else
							if
								30@==4
							then
								01B2: give_actor 2@(27@,25i) weapon 29 ammo 9999 // give smg
							else
								if
									30@==5
								then
									01B2: give_actor 2@(27@,25i) weapon 31 ammo 9999 // m4
								end
							end
						end
					end
				end
				07DD: set_actor 2@(27@,25i) attack_rate 100 // previously known as temper_to
				077A: set_actor 2@(27@,25i) acquaintance 0 to_actors_pedtype 0 // respect cj
				077A: set_actor 2@(27@,25i) acquaintance 0 to_actors_pedtype 8 // respect Grove Street Families
				077A: set_actor 2@(27@,25i) acquaintance 4 to_actors_pedtype 6 // hate Cops
				077A: set_actor 2@(27@,25i) acquaintance 4 to_actors_pedtype 7 // hate Ballas
				077A: set_actor 2@(27@,25i) acquaintance 4 to_actors_pedtype 9 // hate Los Santos Vagos
				077A: set_actor 2@(27@,25i) acquaintance 4 to_actors_pedtype 10 // hate San Fierro Rifa
				077A: set_actor 2@(27@,25i) acquaintance 4 to_actors_pedtype 11 // hate Da Nang Boys
				077A: set_actor 2@(27@,25i) acquaintance 4 to_actors_pedtype 12 // hate Mafia
				077A: set_actor 2@(27@,25i) acquaintance 4 to_actors_pedtype 13 // hate Mountain Cloud Triad
				077A: set_actor 2@(27@,25i) acquaintance 4 to_actors_pedtype 14 // hate Varrio Los Aztecas
				077A: set_actor 2@(27@,25i) acquaintance 4 to_actors_pedtype 15 // hate gang 9
				077A: set_actor 2@(27@,25i) acquaintance 4 to_actors_pedtype 16 // hate gang 10
				060B: set_actor 2@(27@,25i) decision_maker_to 26@ // offensive state
				09B5: set_actor 2@(27@,25i) signal_after_kill 0 // disable the stupid homie handsign they are doing when they kill, making them uninteruptable and effective on gangfights
			end
		end
		
		if
			056D:   actor 3@(27@,25i) defined
		then
			// 05CD: AS_actor 3@(27@,25i) exit_car 0@(27@,25i)
			if
				0449:   actor 3@(27@,25i) in_a_car
			then
				0633: AS_actor 3@(27@,25i) exit_car
				00AA: store_car 0@(27@,25i) position_to 29@ 30@ 31@
				05DC: AS_actor 3@(27@,25i) run_away_from_point 29@ 30@ 31@ stop_at_radius 25.0 timelimit 5000
			end
			if
				02D8:   actor 3@(27@,25i) current_weapon == 0 // unarmed
			then
				0209: 30@ = random_int_in_ranges 1 6
				if
					30@==1
				then
					01B2: give_actor 3@(27@,25i) weapon 16 ammo 9999 // give grenade
				else
					if
						30@==2
					then
						01B2: give_actor 3@(27@,25i) weapon 24 ammo 9999 // give desert eagle
					else
						if
							30@==3
						then
							01B2: give_actor 3@(27@,25i) weapon 27 ammo 9999 //  give spaz
						else
							if
								30@==4
							then
								01B2: give_actor 3@(27@,25i) weapon 29 ammo 9999 // give smg
							else
								if
									30@==5
								then
									01B2: give_actor 3@(27@,25i) weapon 31 ammo 9999 // m4
								end
							end
						end
					end
				end
				07DD: set_actor 3@(27@,25i) attack_rate 100 // previously known as temper_to
				077A: set_actor 3@(27@,25i) acquaintance 0 to_actors_pedtype 0 // respect cj
				077A: set_actor 3@(27@,25i) acquaintance 0 to_actors_pedtype 8 // respect Grove Street Families
				077A: set_actor 3@(27@,25i) acquaintance 4 to_actors_pedtype 6 // hate Cops
				077A: set_actor 3@(27@,25i) acquaintance 4 to_actors_pedtype 7 // hate Ballas
				077A: set_actor 3@(27@,25i) acquaintance 4 to_actors_pedtype 9 // hate Los Santos Vagos
				077A: set_actor 3@(27@,25i) acquaintance 4 to_actors_pedtype 10 // hate San Fierro Rifa
				077A: set_actor 3@(27@,25i) acquaintance 4 to_actors_pedtype 11 // hate Da Nang Boys
				077A: set_actor 3@(27@,25i) acquaintance 4 to_actors_pedtype 12 // hate Mafia
				077A: set_actor 3@(27@,25i) acquaintance 4 to_actors_pedtype 13 // hate Mountain Cloud Triad
				077A: set_actor 3@(27@,25i) acquaintance 4 to_actors_pedtype 14 // hate Varrio Los Aztecas
				077A: set_actor 3@(27@,25i) acquaintance 4 to_actors_pedtype 15 // hate gang 9
				077A: set_actor 3@(27@,25i) acquaintance 4 to_actors_pedtype 16 // hate gang 10
				060B: set_actor 3@(27@,25i) decision_maker_to 26@ // offensive state
				09B5: set_actor 3@(27@,25i) signal_after_kill 0 // disable the stupid homie handsign they are doing when they kill, making them uninteruptable and effective on gangfights
			end
		end
		
		if
			056D:   actor 4@(27@,25i) defined
		then
			// 05CD: AS_actor 4@(27@,25i) exit_car 0@(27@,25i)
			if
				0449:   actor 4@(27@,25i) in_a_car
			then
				0633: AS_actor 4@(27@,25i) exit_car
				00AA: store_car 0@(27@,25i) position_to 29@ 30@ 31@
				05DC: AS_actor 4@(27@,25i) run_away_from_point 29@ 30@ 31@ stop_at_radius 25.0 timelimit 5000
			end
			if
				02D8:   actor 4@(27@,25i) current_weapon == 0 // unarmed
			then
				0209: 30@ = random_int_in_ranges 1 6
				if
					30@==1
				then
					01B2: give_actor 4@(27@,25i) weapon 16 ammo 9999 // give grenade
				else
					if
						30@==2
					then
						01B2: give_actor 4@(27@,25i) weapon 24 ammo 9999 // give desert eagle
					else
						if
							30@==3
						then
							01B2: give_actor 4@(27@,25i) weapon 27 ammo 9999 //  give spaz
						else
							if
								30@==4
							then
								01B2: give_actor 4@(27@,25i) weapon 29 ammo 9999 // give smg
							else
								if
									30@==5
								then
									01B2: give_actor 4@(27@,25i) weapon 31 ammo 9999 // m4
								end
							end
						end
					end
				end
				07DD: set_actor 4@(27@,25i) attack_rate 100 // previously known as temper_to
				077A: set_actor 4@(27@,25i) acquaintance 0 to_actors_pedtype 0 // respect cj
				077A: set_actor 4@(27@,25i) acquaintance 0 to_actors_pedtype 8 // respect Grove Street Families
				077A: set_actor 4@(27@,25i) acquaintance 4 to_actors_pedtype 6 // hate Cops
				077A: set_actor 4@(27@,25i) acquaintance 4 to_actors_pedtype 7 // hate Ballas
				077A: set_actor 4@(27@,25i) acquaintance 4 to_actors_pedtype 9 // hate Los Santos Vagos
				077A: set_actor 4@(27@,25i) acquaintance 4 to_actors_pedtype 10 // hate San Fierro Rifa
				077A: set_actor 4@(27@,25i) acquaintance 4 to_actors_pedtype 11 // hate Da Nang Boys
				077A: set_actor 4@(27@,25i) acquaintance 4 to_actors_pedtype 12 // hate Mafia
				077A: set_actor 4@(27@,25i) acquaintance 4 to_actors_pedtype 13 // hate Mountain Cloud Triad
				077A: set_actor 4@(27@,25i) acquaintance 4 to_actors_pedtype 14 // hate Varrio Los Aztecas
				077A: set_actor 4@(27@,25i) acquaintance 4 to_actors_pedtype 15 // hate gang 9
				077A: set_actor 4@(27@,25i) acquaintance 4 to_actors_pedtype 16 // hate gang 10
				060B: set_actor 4@(27@,25i) decision_maker_to 26@ // offensive state
				09B5: set_actor 4@(27@,25i) signal_after_kill 0 // disable the stupid homie handsign they are doing when they kill, making them uninteruptable and effective on gangfights
			end
		end
		
		01C3: remove_references_to_car 0@(27@,25i) // this shit does not work for me!!!
	else
		Continue
	end
end
if
	056E:   car 0@ defined
then
	if or
		01C1:   car 0@ stopped
		0495:   car 0@ burning 
		02BF:   car 0@ sunk 
		0119:   car 0@ wrecked 
	004D: jump_if_false @checklocation
end
if or
	80DF:  not actor 1@ driving
	0118:  actor 1@ dead
004D: jump_if_false @checklocation
if
	056E:   car 5@ defined
then
	if or
		01C1:   car 5@ stopped
		0495:   car 5@ burning 
		02BF:   car 5@ sunk 
		0119:   car 5@ wrecked 
	004D: jump_if_false @checklocation
end
if or
	80DF:  not actor 6@ driving
	0118:  actor 6@ dead
004D: jump_if_false @checklocation
if
	056E:   car 10@ defined
then
	if or
		01C1:   car 10@ stopped
		0495:   car 10@ burning 
		02BF:   car 10@ sunk 
		0119:   car 10@ wrecked 
	004D: jump_if_false @checklocation
end
if or
	80DF:  not actor 11@ driving
	0118:  actor 11@ dead
004D: jump_if_false @checklocation
if
	056E:   car 15@ defined
then
	if or
		01C1:   car 15@ stopped
		0495:   car 15@ burning 
		02BF:   car 15@ sunk 
		0119:   car 15@ wrecked 
	004D: jump_if_false @checklocation
end
if or
	80DF:  not actor 16@ driving
	0118:  actor 16@ dead
004D: jump_if_false @checklocation
if
	056E:   car 20@ defined
then
	if or
		01C1:   car 20@ stopped
		0495:   car 20@ burning 
		02BF:   car 20@ sunk 
		0119:   car 20@ wrecked 
	004D: jump_if_false @checklocation
end
if or
	80DF:  not actor 21@ driving
	0118:  actor 21@ dead
004D: jump_if_false @checklocation

28@=0
:monitorgangwar
28@+=1
if
	087A:   gang_war_in_progress
004D: jump_if_false @leakremover

FOR 27@ = 0 to 20 step 5
	if
		056D:   actor 1@(27@,25i) defined
	then
		if or
			09A8:   actor 1@(27@,25i) headshoted
			8184:  not actor 1@(27@,25i) health >= 1
			0118:   actor 1@(27@,25i) dead
			80F2:  not actor 1@(27@,25i) near_actor $PLAYER_ACTOR radius 300.0 300.0 sphere 0
			// 8104:  not actor $PLAYER_ACTOR near_actor 1@(27@,25i) radius 300.0 300.0 300.0 sphere 0 // if the gang member was out of bounds then he is a goner
		then
			01C2: remove_references_to_actor 1@(27@,25i) // Like turning an actor into a random pedestrian
		else
			if and // if the member was not doing anything
				82E0:   not actor 1@(27@,25i) firing_weapon
				02A0:   actor 1@(27@,25i) stopped
				8597:   not actor 1@(27@,25i) crouching
			then
				0AB1: call_scm_func @pedattackped param_count 1 baseactor 1@(27@,25i)
			else
				if
					28@>=3000
				then
					0AB1: call_scm_func @pedattackped param_count 1 baseactor 1@(27@,25i)
				end
			end
		end
	end
	if
		056D:   actor 2@(27@,25i) defined
	then
		if or
			09A8:   actor 2@(27@,25i) headshoted
			8184:  not actor 2@(27@,25i) health >= 1
			0118:   actor 2@(27@,25i) dead
			80F2:  not actor 2@(27@,25i) near_actor $PLAYER_ACTOR radius 300.0 300.0 sphere 0
			// 8104:  not actor $PLAYER_ACTOR near_actor 2@(27@,25i) radius 300.0 300.0 300.0 sphere 0 // if the gang member was out of bounds then he is a goner
		then
			01C2: remove_references_to_actor 2@(27@,25i) // Like turning an actor into a random pedestrian
		else
			if and // if the member was not doing anything
				82E0:   not actor 2@(27@,25i) firing_weapon
				02A0:   actor 2@(27@,25i) stopped
				8597:   not actor 2@(27@,25i) crouching
			then
				0AB1: call_scm_func @pedattackped param_count 1 baseactor 2@(27@,25i)
			else
				if
					28@>=3000
				then
					0AB1: call_scm_func @pedattackped param_count 1 baseactor 2@(27@,25i)
				end
			end
		end
	end
	if
		056D:   actor 3@(27@,25i) defined
	then
		if or
			09A8:   actor 3@(27@,25i) headshoted
			8184:  not actor 3@(27@,25i) health >= 1
			0118:   actor 3@(27@,25i) dead
			80F2:  not actor 3@(27@,25i) near_actor $PLAYER_ACTOR radius 300.0 300.0 sphere 0
			// 8104:  not actor $PLAYER_ACTOR near_actor 3@(27@,25i) radius 300.0 300.0 300.0 sphere 0 // if the gang member was out of bounds then he is a goner
		then
			01C2: remove_references_to_actor 3@(27@,25i) // Like turning an actor into a random pedestrian
		else
			if and // if the member was not doing anything
				82E0:   not actor 3@(27@,25i) firing_weapon
				02A0:   actor 3@(27@,25i) stopped
				8597:   not actor 3@(27@,25i) crouching
			then
				0AB1: call_scm_func @pedattackped param_count 1 baseactor 3@(27@,25i)
			else
				if
					28@>=3000
				then
					0AB1: call_scm_func @pedattackped param_count 1 baseactor 3@(27@,25i)
				end
			end
		end
	end
	if
		056D:   actor 4@(27@,25i) defined
	then
		if or
			09A8:   actor 4@(27@,25i) headshoted
			8184:  not actor 4@(27@,25i) health >= 1
			0118:   actor 4@(27@,25i) dead
			80F2:  not actor 4@(27@,25i) near_actor $PLAYER_ACTOR radius 300.0 300.0 sphere 0
			// 8104:  not actor $PLAYER_ACTOR near_actor 4@(27@,25i) radius 300.0 300.0 300.0 sphere 0 // if the gang member was out of bounds then he is a goner
		then
			01C2: remove_references_to_actor 4@(27@,25i) // Like turning an actor into a random pedestrian
		else
			if and // if the member was not doing anything
				82E0:   not actor 4@(27@,25i) firing_weapon
				02A0:   actor 4@(27@,25i) stopped
				8597:   not actor 4@(27@,25i) crouching
			then
				0AB1: call_scm_func @pedattackped param_count 1 baseactor 4@(27@,25i)
			else
				if
					28@>=3000
				then
					0AB1: call_scm_func @pedattackped param_count 1 baseactor 4@(27@,25i)
				end
			end
		end
	end
end

FOR 27@ = 0 to 20 step 5
	if or
		056D: actor 1@(27@,25i) defined
		056D: actor 2@(27@,25i) defined
		056D: actor 3@(27@,25i) defined
		056D: actor 4@(27@,25i) defined
	then
		break
	else
		if
			27@<20
		004D: jump_if_false @leakremover 
		continue
	end
end

if
	28@>=3000
then
	28@=0
end
// wait 5000 ms // this avoids hang
wait 1 ms // this avoids hang
0002: jump @monitorgangwar

:leakremover
FOR 27@ = 0 to 20 step 5
	if
		056E:   car 0@(27@,25i) defined
	then
		01C3: remove_references_to_car 0@(27@,25i)
	end
	if
		056D:   actor 1@(27@,25i) defined
	then
		01C2: remove_references_to_actor 1@(27@,25i) // Like turning an actor into a random pedestrian
	end
	if
		056D:   actor 2@(27@,25i) defined
	then
		01C2: remove_references_to_actor 2@(27@,25i) // Like turning an actor into a random pedestrian
	end
	if
		056D:   actor 3@(27@,25i) defined
	then
		01C2: remove_references_to_actor 3@(27@,25i) // Like turning an actor into a random pedestrian
	end
	if
		056D:   actor 4@(27@,25i) defined
	then
		01C2: remove_references_to_actor 4@(27@,25i) // Like turning an actor into a random pedestrian
	end
end
0002: jump @initiatesupports // go back from the start

:pedattackped
{ Parameters:
Passed:
0@ - Base Actor

Usage:
0AB1: call_scm_func @pedattackped param_count 1 baseactor 13@
13@ - base actor
 }

00A0: store_actor $PLAYER_ACTOR position_to 29@ 30@ 31@
REPEAT
	25@=-1
	0AE1: 25@ = random_actor_near_point 29@ 30@ 31@ in_radius 100.0 find_next 1 pass_deads 1
	if
		25@<>-1
	then
		if
			056D:   actor 25@ defined
		then
			089F: get_actor 25@ pedtype_to 26@
			if and // matches any cop and gang except grove street families
				26@>=6
				26@<>8
				26@<=16
				8118:  not actor 25@ dead
				89A8:  not actor 25@ headshoted
				0184:  actor 25@ health >= 1
			then
				if
					056D:   actor 0@ defined
				then
					05E2: AS_actor 0@ kill_actor 25@
				end
				Break
			end
		end
	end
UNTIL 25@==-1
if
	25@<>-1
then
	if
		056D:   actor 25@ defined
	then
		if or
			26@<6
			26@==8
			26@>16
			0118:  actor 25@ dead
			09A8:  actor 25@ headshoted
			8184:  not actor 25@ health >= 1
		then
			25@=-1
		end
	end
end
if
	25@==-1
then
	00A0: store_actor 0@ position_to 29@ 30@ 31@
	REPEAT
		25@=-1
		0AE1: 25@ = random_actor_near_point 29@ 30@ 31@ in_radius 60.0 find_next 1 pass_deads 1
		if
			25@<>-1
		then
			if
				056D:   actor 25@ defined
			then
				089F: get_actor 25@ pedtype_to 26@
				if and // matches any cop and gang except grove street families
					26@>=6
					26@<>8
					26@<=16
					8118:  not actor 25@ dead
					89A8:  not actor 25@ headshoted
					0184:  actor 25@ health >= 1
				then
					if
						056D:   actor 0@ defined
					then
						05E2: AS_actor 0@ kill_actor 25@
					end
					Break
				end
			end
		end
	UNTIL 25@==-1
end

0AB2: ret 0